#include "ServerWriterThread.h"
#include "Socket.h"
#include <string>

void ServerWriterThread::Work()
{
	
	
	while(true)
	{
		SockMessage outMsg;
		std::string s;
		std::getline(std::cin,s,'\n');
		outMsg.WriteString("Server: ");
		outMsg.WriteString(s);
		for(unsigned int i=0;i<TheServer::Instance()->NumOfClients();++i)
		{
			TheServer::Instance()->GetClient(i)->Send(outMsg);
		}
	}
}